import time
from selenium import webdriver
from selenium.common import NoSuchElementException
from selenium.webdriver.common.by import By

web = webdriver.Edge()
web.get("https://www.byhy.net/cdn2/files/selenium/sample1.html")

       #find_element只找到符合要求的第一个元素
elements = web.find_elements(By.CLASS_NAME, "animal") #这里find_elements不会抛异常，只会返回一个空列表
for element in elements:
    print(element.text)

elements = web.find_elements(By.TAG_NAME, "span")  #通过标签找到所以目标元素
for element in elements:
    print(element.text)
time.sleep(100)